from Ling.common.dao.MysqlDao import fetch_all


def fetch_all_books(category):
    # results = fetch_all('select name, i_reader_id from base_reader_book b where b.category2 =%s and i_reader_id=%s', [category,'11734435'])
    results = fetch_all('select name, i_reader_id from base_reader_book b where b.category2 =%s ',
                        [category])
    return results


def fetch_all_book_chapters(ireader_id):
    results = fetch_all(
        'select chapter_name, path, index_ from base_reader_book_chapter where i_reader_id = %s order by index_ asc',
        [ireader_id])
    return results
